<?php
class debug{
	public static $self;
	public static $log;
	function add(){
		$a=debug_backtrace();
		array_shift($a);
		foreach ($a as $d){
			$hash=sha1(serialize($d));
			self::$log["{$hash}"][]=$d;
		}
	}
}
function debug($line){
	echo "Line:{$line}\n";
	$a=debug_backtrace();
	//array_shift($a);
	//array_pop($a);
	print_r($a);
}
register_tick_function(array('debug','add'));
declare(ticks=1);

echo 'a';

function test(){
	echo 'n';

	test2();
}
$a++;
$n++;
$c++;
$d++;
$e++;
test();


function test2(){
	echo 'z';
	echo 'b';
	$i++;
}

print_r(debug::$log);